package org.ggn.init;

import java.util.List;

import org.ggn.model.Course;
import org.ggn.model.Grade;
import org.ggn.util.DirFinalValue;
import org.ggn.util.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;

public class InitDirInfo {

	public static void main(String[] args) {

		Session session = null;
		try {
			session = HibernateUtil.openSession();
			session.beginTransaction();

			Query query = session.createQuery("from Course");
			List<Course> courses = query.list();
			for(Course course : courses ){
				course.setExam_info(DirFinalValue.exam_iofo);
				course.setpaper_year_an(DirFinalValue.pager_year_an);
				course.setpaper_year_noan(DirFinalValue.pager_year_no);
			}
			
			session.getTransaction().commit();
		} 
		finally{
			HibernateUtil.close(session);
		}
	}

}
